﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GSMClasses
{
    public class Display
    {
        //fields
        private float? size;
        private int? colors;

        //constructors
        public Display()
        {
        }
        public Display(float? size)
            : this(size, null)
        {
        }
        public Display(float? size, int? colors)
        {
            this.Size = size;
            this.Colors = colors;
        }

        //properties
        public float? Size
        {
            get { return size; }
            set
            {
                if (value >= 0 || value == null)
                {
                    this.size = value;
                }
                else
                {
                    throw new ArgumentOutOfRangeException();
                }
            }
        }
        public int? Colors
        {
            get { return colors; }
            set
            {
                if (value >= 0 || value == null)
                {
                    this.colors = value;
                }
                else
                {
                    throw new ArgumentOutOfRangeException();
                }
            }
        }

        //methods
        public override string ToString()
        {
            StringBuilder infoText = new StringBuilder();
            if (size != null)
            {
                infoText.Append("display size:");
                infoText.AppendLine(this.size.ToString());
            }
            if (colors != null)
            {
                infoText.Append("display color:");
                infoText.Append(this.colors.ToString());
            }
            return infoText.ToString();
        }
    }
}
